package com.pet.server.ext.action.user;

import java.util.List;

import com.pet.server.ext.ActionBase;
import com.pet.server.ext.ApiError;
import com.pet.server.ext.Result;
import com.pet.server.ext.data.PetAdopt;
import com.pet.server.ext.service.UserService;
import com.pet.server.ext.util.JsonUtil;
import com.pet.server.ext.util.Parameters;

public class Adoptlist extends ActionBase{
	
	public String userName,password,owner;	
	public Adoptlist(){
		 needCheckAuth =true;
	}
	
	@Override
	public void initParameters(Parameters params) throws ApiError {	
	   // owner = meta.getParam("param_0");
	}
	@Override
	public Result invokeService() throws ApiError {
		UserService userService = new UserService();
		//Integer userId = "my".equals(owner)?user.user_id:null;
		//List<PetAdopt> list = userService.queryPetAdoptByItemUserId(user.user_id);
		
		System.out.println(user.user_id+"  =========================");
		
		List<PetAdopt> list = userService.queryPetAdopt(user.user_id);
		
		Result result = new Result();
		result.ret.put("data",JsonUtil.adoptToJsonArray(list));
	    return result;
	}
}
